/**
 * 
 */
package net.ondev.dutils.tostring;

import org.eclipse.jdt.internal.core.CompilationUnit;
import org.eclipse.jdt.internal.ui.javaeditor.CompilationUnitEditor;
import org.eclipse.jface.action.IAction;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.ui.IEditorActionDelegate;
import org.eclipse.ui.IEditorPart;

/**
 * @author Liu Jie
 *
 */
public class ToStringActionEditorDelegate extends BaseActionDelegate implements IEditorActionDelegate {

	CompilationUnitEditor editor;
	/* 
	 * @see org.eclipse.ui.IEditorActionDelegate#setActiveEditor(org.eclipse.jface.action.IAction, org.eclipse.ui.IEditorPart)
	 */
	public void setActiveEditor(IAction action, IEditorPart targetEditor) {
		editor = (CompilationUnitEditor) targetEditor;
		
		CompilationUnit cunit = (CompilationUnit)editor.getViewPartInput();
	
		targetElements.clear();
		
		addTargetElements(cunit);
	}
	
	
	public void selectionChanged(IAction action, ISelection selection) {
		//Do nothing 
		
	}

}
